<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// The below test undo paste, when the caret is not in range.
selection_test(
  '<div contenteditable>^def|\u00A0</div>',
  selection => {
    const document  = selection.document;
    const edit = document.querySelector('div');
    selection.setClipboardData('abc');
    document.execCommand('paste');
    selection.collapse(edit, edit.childNodes.length);
    document.execCommand('undo');
  },
  '<div contenteditable>^def|\u00A0</div>',
  'Undo paste should work when caret not in range'
);
</script>